﻿<%@ Page Language="C#" MasterPageFile="~/OperaEntry/MasterPage.master"  ValidateRequest="false" CodeFile="Products.aspx.cs" Inherits="OperaEntry_Products" Title="管理页 - 产品管理" %>

<asp:Content ID="Content3" ContentPlaceHolderID="OpMain" Runat="Server" >
    <script type="text/javascript" src="../Jscript/nicEdit.js"></script>
    
    <table class="tblcontent" border="1px">
    <tr>
        <td class="tdcaption" align="right" style="width:100px;">产品名称：</td>
        <td style="width:400px;"><asp:HiddenField runat="server" ID="txtProductId" /><asp:TextBox runat="server" ID="txtProductName" Width="197px"></asp:TextBox>
            <asp:Button ID="btnProduct" Text="选 择" runat="server" 
                OnClientClick="javascript:return selectProduct(this);" 
                onclick="btnProduct_Click" /></td>
    </tr>
    <tr>
        <td class="tdcaption" align="right">类别：</td>
        <td><asp:HiddenField runat="server" ID="txtTypeId" /><asp:TextBox runat="server" ID="txtTypeName" Enabled="false"></asp:TextBox><asp:Button Text="选 择" runat="server" OnClientClick="javascript:selectNode(this);return false;" /> </td>
    </tr>
    <tr>
        <td class="tdcaption" align="right" >厂商：</td>
        <td><asp:HiddenField runat="server" ID="txtMakerId" /><asp:TextBox runat="server" 
                ID="txtMakerName" Width="130px"></asp:TextBox><asp:Button ID="Button1" Text="选 择" runat="server" OnClientClick="javascript:selectMaker(this);return false;" /></td>
    </tr>
    <tr>
        <td class="tdcaption" align="right" >订价：</td>
        <td><asp:TextBox runat="server" ID="txtPrice"></asp:TextBox></td>
    </tr>
    <tr>
        <td class="tdcaption" align="right" >数量：</td>
        <td><asp:TextBox runat="server" ID="txtQuantity"></asp:TextBox></td>
    </tr>
    <tr>
        <td class="tdcaption" align="right" >图片：</td>
        <td>
            <asp:FileUpload ID="FileUpload" runat="server" />
            <asp:Button runat="server" Text="上传" ID="btnUpfile" onclick="btnUpfile_Click" />
            <asp:CheckBox ID="cmbIsIcon" runat="server" Text="设为图标" />
        </td>
    </tr>
    <tr>
        <td class="tdcaption" align="right" >商品介绍：</td>
        <td style=" height:360px;">
            <asp:TextBox TextMode="MultiLine" runat="server" ID="txtDescription" 
                Width="600px" Height="350"></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td colspan="2" align="center"><asp:Button runat="server" Text="提交" ID="btnEdit" 
                onclick="btnEdit_Click"/></td>
    </tr>
    </table>
    
    
    <script type="text/javascript" >
    bkLib.onDomLoaded(function() {
        var txtid = document.getElementsByTagName("TextArea")[0].id;
	    new nicEditor({fullPanel : true}).panelInstance(txtid);
    });
    function selectNode(obj)
    {
        var iHeight = 600;
        var iWidth = 600;
        var iTop = (window.screen.availHeight-30-iHeight)/2; //获得窗口的垂直位置;
        var iLeft = (window.screen.availWidth-10-iWidth)/2; //获得窗口的水平位置;
        var valueObjId = '<%= this.txtTypeName.ClientID %>';
        var keyObjId = '<%= this.txtTypeId.ClientID %>';
        subwin = window.open('TypeSelect.aspx?keyCtl='+keyObjId + '&valueCtl=' + valueObjId,'选择分类','top=' + iTop + ',left=' + iLeft + ',fullscreen=no,channelmode=yes,width=' + iWidth + ',height=' + iHeight + ',location=no,menubar=no,resizable=yes,scrollbars=no,status=no,titlebar=no,toolbar=no');
        subwin.focus();
        
    }
    function selectMaker(obj)
    {
        var iHeight = 600;
        var iWidth = 900;
        var iTop = (window.screen.availHeight-30-iHeight)/2; //获得窗口的垂直位置;
        var iLeft = (window.screen.availWidth-10-iWidth)/2; //获得窗口的水平位置;
        var valueObjId = '<%= this.txtMakerName.ClientID %>';
        var keyObjId = '<%= this.txtMakerId.ClientID %>';
        subwin = window.open('MakerSelect.aspx?keyCtl='+keyObjId + '&valueCtl=' + valueObjId,'选择厂商','top=' + iTop + ',left=' + iLeft + ',fullscreen=no,channelmode=yes,width=' + iWidth + ',height=' + iHeight + ',location=no,menubar=no,resizable=yes,scrollbars=no,status=no,titlebar=no,toolbar=no');
        subwin.focus();
    }
    function selectProduct(obj)
    {
        if(document.getElementById("<%= this.txtProductName.ClientID %>").value != "")
        {
            if(!window.confirm("是否放弃当前编辑？"))
            {
                return false;
            }
        }
        var iHeight = 600;
        var iWidth = 900;
        var iTop = (window.screen.availHeight-30-iHeight)/2; //获得窗口的垂直位置;
        var iLeft = (window.screen.availWidth-10-iWidth)/2; //获得窗口的水平位置;
        var valueObjId = '<%= this.txtProductName.ClientID %>';
        var keyObjId = '<%= this.txtProductId.ClientID %>';
        subwin = window.open('ProductSelect.aspx?JSCallBack=selectProductCallBack&keyCtl='+keyObjId + '&valueCtl=' + valueObjId,'选择厂商','top=' + iTop + ',left=' + iLeft + ',fullscreen=no,channelmode=yes,width=' + iWidth + ',height=' + iHeight + ',location=no,menubar=no,resizable=yes,scrollbars=no,status=no,titlebar=no,toolbar=no');
        subwin.focus();
        return false;
    }
    function selectProductCallBack()
    {
        //var form = document.forms[0];
        var btn = document.getElementById("<%= this.btnProduct.ClientID %>");
        var oldClick = btn.onclick;
        btn.onclick = function(){return true;}
        btn.click();
        btn.onclick = oldClick;
        return true;
    }
    </script>
</asp:Content>